<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_third', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->index()->default(0)->comment('用户ID');
            $table->string('platform',30)->index()->default(0)->comment('所属平台');
            $table->string('openid',100)->default(0)->comment('三方openid');
            $table->string('nickname',100)->default(0)->comment('三方账号昵称');
            $table->string('unionid',30)->default(0)->comment('unionid');
            $table->integer('created_at')->default(0)->comment('创建时间');
            $table->integer('updated_at')->default(0)->comment('修改时间');
        });
        DB::statement("ALTER TABLE `user_third` comment '【用户】第三方登录'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_third');
    }
};
